package com.xw.class03;

/**
 * @author: xw
 * @create: 2022/9/14 9:56
 * @description: 得到最大值
 */
public class Code08_GetMax {
    public static int getMax(int[] array){
        return process(array,0,array.length-1);
    }

    private static int process(int[] array, int left, int right) {
        if(left == right){
            return array[left];
        }
        int mid = left +((right-left)>>1);
        int leftMax=process(array,left,mid);
        int rightMax=process(array,mid+1,right);
        return Math.max(leftMax,rightMax);

    }
}
